package com.burstly.lib.component.networkcomponent.burstly.html;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import com.burstly.lib.component.networkcomponent.burstly.wrapper.WebViewClientWrapper;
import com.burstly.lib.util.UiSafeWebView;

public class LoadingAwareWebView extends UiSafeWebView
  implements View.OnTouchListener
{
  boolean mFirstTimeLoad = true;
  private FrameLayout mProgressDialogLayout;

  public LoadingAwareWebView(Context paramContext)
  {
    super(paramContext);
    setOnTouchListener(this);
    setWebViewClient(new WebViewClient());
  }

  public LoadingAwareWebView hideLoadingBar()
  {
    if (this.mProgressDialogLayout != null)
    {
      removeView(this.mProgressDialogLayout);
      this.mProgressDialogLayout = null;
    }
    return this;
  }

  public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
  {
    switch (paramMotionEvent.getAction())
    {
    default:
    case 0:
    case 1:
    }
    while (true)
    {
      return false;
      if (!paramView.hasFocus())
        paramView.requestFocus();
    }
  }

  public void setWebViewClient(WebViewClient paramWebViewClient)
  {
    super.setWebViewClient(new LoadingWebClient(paramWebViewClient));
  }

  public LoadingAwareWebView showLoadingBar()
  {
    if (this.mProgressDialogLayout == null)
    {
      this.mProgressDialogLayout = new LoadingBarView(getContext());
      addView(this.mProgressDialogLayout);
    }
    return this;
  }

  private class LoadingWebClient extends WebViewClientWrapper
  {
    LoadingWebClient(WebViewClient arg2)
    {
      super();
    }

    public void onPageFinished(WebView paramWebView, String paramString)
    {
      super.onPageFinished(paramWebView, paramString);
      if (LoadingAwareWebView.this.mFirstTimeLoad)
        LoadingAwareWebView.this.hideLoadingBar();
      LoadingAwareWebView.this.mFirstTimeLoad = false;
    }

    public void onPageStarted(WebView paramWebView, String paramString, Bitmap paramBitmap)
    {
      super.onPageStarted(paramWebView, paramString, paramBitmap);
      if (LoadingAwareWebView.this.mFirstTimeLoad)
        LoadingAwareWebView.this.showLoadingBar();
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.html.LoadingAwareWebView
 * JD-Core Version:    0.6.2
 */